<?php

use Jialeo\LaravelSchemaExtend\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AddThirdApiColumnToRepayRecordsTable extends Migration
{
    private $table = 'repay_records';

    /*
     *
   `third_record_id` varchar(255) NOT NULL DEFAULT '' COMMENT '资方接口返回,月保请求id',
   `trade_no` varchar(255) NOT NULL DEFAULT '' COMMENT '平台内唯一流水号',
     */
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table($this->table, function (Blueprint $table) {
            $table->string('result_repay_id', 255)->default('')->comment('商户代偿接口返回的结果查询id')->after('bank_cards_id');
            $table->string('trade_no', 255)->default('')->comment('平台内唯一流水号')->after('result_repay_id');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        if(Schema::hasTable($this->table)){
            Schema::table($this->table, function (Blueprint $table) {
                $table->dropColumn('result_repay_id');
                $table->dropColumn('trade_no');
            });
        }
    }
}
